Importing Data
school_leap <- full %>% select(c(2,3,5,6,7, 9:16, 109:129, 131:132, 151:156, 165:167, 281:286))leaps_rank_cols <- c("leaps_rank_affirmation", "leaps_rank_anytime_anywhere", "leaps_rank_connection", "leaps_rank_customization", "leaps_rank_high_expectations", "leaps_rank_relevance", "leaps_rank_rigorous_learning", "leaps_rank_self_direction", "leaps_rank_social_consciousness", "leaps_rank_whole_child")
leaps_cols <- c("leaps_affirmation", "leaps_anytime_anywhere", "leaps_connection", "leaps_customization", "leaps_high_expectations", "leaps_relevance", "leaps_rigorous_learning", "leaps_self_direction", "leaps_social_consciousness", "leaps_whole_child")
# Realized this was not necessary
for (col_name in leaps_rank_cols) {
school_leap[, col_name][school_leap[, col_name] == 0] <- NA
}library(gridExtra)##
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
##
## combine
p.1 <- school_leap %>%
ggplot(aes(x = factor(leaps_affirmation, labels = 0:1)))+
geom_bar(fill = "#1A4C81")+
labs(x="Leaps Affirmation", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 8
) +
scale_x_discrete(labels = c("0", "1"))
p.2 <- school_leap %>%
ggplot(aes(x = factor(leaps_anytime_anywhere, labels = 0:1)))+
geom_bar(fill = "#59C3B4")+
labs(x="Leaps Anytime Anywhere", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 8
) +
scale_x_discrete(labels = c("0", "1"))
p.3 <- school_leap %>%
ggplot(aes(x = factor(leaps_connection, labels = 0:1)))+
geom_bar(fill = "#EF464B")+
labs(x="Leaps Connection", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 8
) +
scale_x_discrete(labels = c("0", "1"))
p.4 <- school_leap %>%
ggplot(aes(x = factor(leaps_customization, labels = 0:1)))+
geom_bar(fill = "#ADE0EE")+
labs(x="Leaps Customization", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 8
) +
scale_x_discrete(labels = c("0", "1"))
p.5 <- school_leap %>%
ggplot(aes(x = factor(leaps_high_expectations, labels = 0:1)))+
geom_bar(fill = "#BC2582") +
labs(x="Leaps High Expectations", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 8
) +
scale_x_discrete(labels = c("0", "1"))
p.6 <- school_leap %>%
ggplot(aes(x = factor(leaps_relevance, labels = 0:1)))+
geom_bar(fill = "#FFA630") +
labs(x="Leaps Relevance", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 8
) +
scale_x_discrete(labels = c("0", "1"))
p.7 <- school_leap %>%
ggplot(aes(x = factor(leaps_rigorous_learning, labels = 0:1)))+
geom_bar(fill = "#99C24D") +
labs(x="Leaps Rigorous Learning", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 8
) +
scale_x_discrete(labels = c("0", "1"))
p.8 <- school_leap %>%
ggplot(aes(x = factor(leaps_self_direction, labels = 0:1)))+
geom_bar(fill = "#FFDE42") +
labs(x="Leaps Self Direction", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 8
) +
scale_x_discrete(labels = c("0", "1"))
p.9 <- school_leap %>%
ggplot(aes(x = factor(leaps_social_consciousness, labels = 0:1)))+
geom_bar(fill = "#218380") +
labs(x="Leaps Social Consciousness", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 8
) +
scale_x_discrete(labels = c("0", "1"))
p.10 <- school_leap %>%
ggplot(aes(x = factor(leaps_whole_child, labels = 0:1))) +
geom_bar(fill = "#D3B7D7") +
labs(x="Leaps Whole Child", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 8
) +
scale_x_discrete(labels = c("0", "1"))
ggarrange(p.1, p.2, p.3, p.4, p.5, p.6, p.7, p.8, p.9, p.10, nrow = 3, ncol = 4)High expectations and whole child were the most likely to be reported as being implemented.
library(gridExtra)
leaps_percentage <- data.frame(
name = character(),
percent_yes = numeric(),
# percent_no = numeric(),
stringsAsFactors = FALSE
)
for (i in leaps_cols){
percent_yes <- round(sum(school_leap[[i]])/length(school_leap[[i]]) *100,2)
# percent_no <- round((length(school_leap[[i]]) - sum(school_leap[[i]]))/length(school_leap[[i]])*100, 2)
leaps_percentage <- rbind(leaps_percentage, data.frame(name = i, percent_yes = percent_yes))
}
leaps_percentage_long <- leaps_percentage %>%
pivot_longer(cols = c("percent_yes"), names_to = "Status", values_to = "Percentage")
# Create a grouped bar plot
ggplot(leaps_percentage_long, aes(x = reorder(name, Percentage), y = Percentage, fill = Status)) +
geom_bar(stat = "identity", position = "dodge", show.legend = FALSE) +
geom_text(aes(label = Percentage), color = "black", size = 4, hjust = -.25) +
theme_minimal() +
labs(title = "Leaps Implementation", x = "Practice", y = "Percentage") +
scale_fill_manual(values = c("percent_yes" = "#1A4C81")) +
coord_flip()library(gridExtra)
p1 <- school_leap %>%
filter(!is.na(leaps_rank_affirmation)) %>%
ggplot(aes(x = factor(leaps_rank_affirmation, labels = 1:10)))+
geom_bar(fill = "#1A4C81")+
labs(x="Leaps Rank Affirmation", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 5
) +
scale_x_discrete(labels = 1:10)
p2 <- school_leap %>%
filter(!is.na(leaps_rank_anytime_anywhere)) %>%
ggplot(aes(x = factor(leaps_rank_anytime_anywhere, labels = 1:10)))+
geom_bar(fill = "#59C3B4")+
labs(x="Leaps Rank Anytime Anywhere", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 5
) +
scale_x_discrete(labels = 1:10)
p3 <- school_leap %>%
filter(!is.na(leaps_rank_connection)) %>%
ggplot(aes(x = factor(leaps_rank_connection,labels = 1:10)))+
geom_bar(fill = "#EF464B")+
labs(x="Leaps Rank Connection", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 5
) +
scale_x_discrete(labels = 1:10)
p4 <- school_leap %>%
filter(!is.na(leaps_rank_customization)) %>%
ggplot(aes(x = factor(leaps_rank_customization, label =1:10)))+
geom_bar(fill = "#ADE0EE")+
labs(x="Leaps Rank Customization", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 5
) +
scale_x_discrete(labels = 1:10)
p5 <- school_leap %>%
filter(!is.na(leaps_rank_high_expectations)) %>%
ggplot(aes(x = factor(leaps_rank_high_expectations, labels = 1:10)))+
geom_bar(fill = "#BC2582")+
labs(x="Leaps Rank High Expectations", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 5
) +
scale_x_discrete(labels = 1:10)
p6 <- school_leap %>%
filter(!is.na(leaps_rank_relevance)) %>%
ggplot(aes(x = factor(leaps_rank_relevance, labels=1:10)))+
geom_bar(fill = "#FFA630")+
labs(x="Leaps Rank Relevance", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 5
) +
scale_x_discrete(labels = 1:10)
p7 <- school_leap %>%
filter(!is.na(leaps_rank_rigorous_learning))%>%
ggplot(aes(x = factor(leaps_rank_rigorous_learning, labels = 1:10)))+
geom_bar(fill = "#99C24D")+
labs(x="Leaps Rank Rigorous Learning", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 5
) +
scale_x_discrete(labels = 1:10)
p8 <- school_leap %>%
filter(!is.na(leaps_rank_self_direction)) %>%
ggplot(aes(x = factor(leaps_rank_self_direction, labels = 1:10)))+
geom_bar(fill = "#FFDE42")+
labs(x="Leaps Rank Self Direction", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 5
) +
scale_x_discrete(labels = 1:10)
p9 <- school_leap %>%
filter(!is.na(leaps_rank_social_consciousness))%>%
ggplot(aes(x = factor(leaps_rank_social_consciousness, labels = 1:10)))+
geom_bar(fill = "#218380")+
labs(x="Leaps Rank Social consciousness", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 5
) +
scale_x_discrete(labels = 1:10)
p10 <- school_leap %>%
filter(!is.na(leaps_rank_whole_child))%>%
ggplot(aes(x = factor(leaps_rank_whole_child, labels = 1:10)))+
geom_bar(fill = "#D3B7D7")+
labs(x="Leaps Rank Whole Child", y = "Count")+
geom_text(
stat = "count",
aes(label = after_stat(count)),
vjust = 0.75,
color = "black",
size = 5
) +
scale_x_discrete(labels = 1:10)
ggarrange(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, ncol = 3, nrow = 4)# Load the required packages
library(ggplot2)
# Create a data frame with the ranking and implementation data
rank_data <- data.frame(
Practice = leaps_cols,
Ranking = c(7, 2, 5, 9, 3, 6, 10, 4, 8, 1),
Implementation = c(57.77, 43.03, 71.71, 62.55, 74.50, 62.55, 66.14, 60.56, 48.21, 67.33)
)
leaps_cols## [1] "leaps_affirmation" "leaps_anytime_anywhere"
## [3] "leaps_connection" "leaps_customization"
## [5] "leaps_high_expectations" "leaps_relevance"
## [7] "leaps_rigorous_learning" "leaps_self_direction"
## [9] "leaps_social_consciousness" "leaps_whole_child"
custom_labels <- c("Whole Child", "Anytime Anywhere", "High Expectations", "Self Direction", " Connection",
"Relevance", "Affirmation", "Social Consciousness", "Customization", "Rigorous Learning")
# Create the bar chart ordered by rank
ggplot(rank_data, aes(x = reorder(Practice, Ranking))) +
geom_bar(aes(y = Implementation), stat = "identity", fill = "#1A4C81") +
scale_y_continuous(
name = "Percentage of Implementation",
sec.axis = sec_axis(~./(max(rank_data$Ranking) / max(rank_data$Implementation)),
name = "")
) +
geom_text(aes(y = Ranking, label = Ranking), color = "#EF464B", size = 6, vjust = -0.25) +
geom_text(aes(y = Implementation, label = Implementation), color = "black", size = 4, vjust = 2.25) +
scale_x_discrete(labels = custom_labels) +
labs(title = "Ranking and Percentage of Implementation", x = "") +
theme_minimal()+
ylim(0, 100)+
theme(axis.text.x = element_text(angle = 45, hjust = 1))## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.